www.mxdraw.com
内容索引主面
前一个向上下一个
IMxDrawCustomEntity::Draw 方法

把实体绘制到图上。一般用于动态拖放时,在拖放结束时,绘制到图上

IDL
[helpstring("method Draw")]
HRESULT Draw([out,retval] IMxDrawResbuf** ppNewId);

返回新绘制的实体的id.

例如: JS,下面是动态插入图块,在用户点击一点确定后,把图块制在图上。

                function DynInsert() {
                    var sBlkName = "Tree";
                    var sBlkFile = mxOcx.GetOcxAppPath() + "\Blk\树.dwg";
                    mxOcx.InsertBlock(sBlkFile, "Tree");


                    var getPt = mxOcx.NewComObject("IMxDrawUiPrPoint");
                    getPt.message = "点取插入点";

                    var spDrawData1 = getPt.InitUserDraw("TestDynDraw1");
                    spDrawData1.SetString("BlkName","Tree");

                    if (getPt.go() != 1) {
                        return;
                    }

                    var frstPt = getPt.value();
                    if (frstPt == null) {

                        return;
                    }


                    var getSecondPt = mxOcx.NewComObject("IMxDrawUiPrPoint");

                    var spDrawData = getSecondPt.InitUserDraw("TestDynDraw");


                    getSecondPt.message = "点取旋转角度";
                    getSecondPt.basePoint = frstPt;
                    getSecondPt.setUseBasePt(true);

                    spDrawData.SetPoint("pt1", frstPt);




                    spDrawData.SetString("BlkName", "Tree");

                    if (getSecondPt.go() != 1) {

                        return;
                    }

                    spDrawData.Draw();

                }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!